/*
============================================================================
 Name        : fTimer.h
 Author      : 
 Version     :
 Copyright   : Your copyright notice
 Description : CfTimer declaration
============================================================================
*/

#ifndef fTIMER_H
#define fTIMER_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
 
class fTimerObserver
{
public:
    /**
     @fn void TimerExpired(TTimerType aType) = 0
     @brief The function to be called when a timeout occurs, abstract virtual
     @param[in] aType Timer type of CTimeOutTimer
     */
    virtual void TimerExpired( int aType ) = 0;
};

class fTimer : public CTimer
{
public:
    static fTimer *NewL( const TInt aPriority, fTimerObserver & aTimeOutNotify, int aTimerType );
    static fTimer *NewLC( const TInt aPriority, fTimerObserver & aTimeOutNotify, int aTimerType );
    ~fTimer( );
public:
    void After( TTimeIntervalMicroSeconds32 anInterval );
private:
    void DoCancel( );
    TTimeIntervalMicroSeconds ActiveTime( );
protected:
    virtual void RunL( );
private:
    fTimer( const TInt aPriority, fTimerObserver & aTimeOutNotify, int aTimerType );
    void ConstructL( );
private:
    fTimerObserver & iNotify;
    int iTimerType;
    TTime iLastActiveTime;
};
#endif // fTIMER_H
